CHAPTER 16 Getting Straight Talk on Straight-Line Regression 217
Fortunately, most statistical packages can perform a straight-line regression.
Microsoft Excel has built-in functions for calculating the slope and intercept of
the least-squares straight line. You can also find straight-line regression web
pages (several are listed at https://statpages.info). If you use R, you can
explore using the lm() command. (See Chapter 4 for an introduction to statistical
software.) In the following sections, we list the basic steps for running a straight-
line regression, complete with an example.
Taking a few basic steps
The exact steps you take to run a straight-line regression depend on what soft-
ware you’re using, but here’s the general approach:
1.
Structure your data into the proper form.
Usually, the data consist of two columns of numbers, one representing the
independent variable and the other representing the dependent variable.
2.
Tell the software which variable is the independent variable and which
one is the dependent variable.
Depending on the software, you may type in the variable names, or pick them
from a menu or list in your file.
3.
If the software offers output options, tell it that you want it to output
these results:
• Graphs of observed and calculated values
• Summaries and graphs of the residuals
• Regression table
• Goodness-of-fit measures
4.
Execute the regression in the software (tell it to run the regression).
Then go look for the output. You should see the output you requested in
Step 3.
Walking through an example
To see how to run a straight-line regression and interpret the output, we use the
following example throughout the rest of this chapter.
Consider how blood pressure (BP) is related to body weight. It may be reasonable
to suspect that people who weigh more have higher BP. If you test this hypothesis